package com.grf.scala

import scala.collection.mutable

object Match {
  def main(args: Array[String]): Unit = {
    //    val i: Any = Array("1", "2", "3")
    //    val res = i match {
    //      case Array(0) => println(Array(0))
    //      case Array(x, y) => x + "=" + y
    //      case 1 => println("1")
    //      case i: Int => println("i")
    //      case a1: Array[String] => "数组"
    //      case _ => println("Default")
    //
    //    }
    //    println(res)
    tuple
  }

  def tuple: Unit = {
    val a = Array((0, 0), (1, 0), (2, 3))
    for (aa <- a) {
      val res = aa match {
        case (0, _) => "0..."
        case (y, 0) => y
        case (x, y) => (y,x)
        case _ => "默认匹配"
      }
      println(res)
    }

    /**
      * 对象匹配
      */
    def matchObject: Unit ={

    }
  }


}

